#!/usr/bin/env coffee
# Concatenate JavaScript files along with their original source maps
# Usage: js-concat-sourcemap OUTPUT_JS INPUT_JS...
#
# Author: Jaeho Shin <netj@cs.stanford.edu>
# Created: 2014-10-07

[output, sources...] = process.argv[2..]
console.error "#{output} concatenates files below with source map:"
console.error "  #{src}" for src in sources
files = {}; files[output] = sources

process.argv = [process.argv[0..1]..., "concat_sourcemap"]
grunt = require "grunt"
grunt.initConfig
    concat_sourcemap:
        target:
            files: files
grunt.loadNpmTasks("grunt-concat-sourcemap");
grunt.cli
    base: process.env.PWD
    gruntfile: "/dev/null"
